package me.zynaga.ragecraft;

import java.io.File;
import java.util.logging.Level;

public final class Settings {

    private Ragecraft plugin;
    private String settingsName = "settings.yml";
    private File pluginSettings = null;
    boolean isReady = false;

    public Settings(Ragecraft instance) {

        plugin = instance;

        //TEMPORARY BUKKIT BUG FIX - CONTINUE WITHOUT SETTINGS
        isReady = true;

        try {

            pluginSettings = new File(plugin.pluginPath, settingsName);

            if (pluginSettings.exists() == true) {

                plugin.getConfig().load(pluginSettings);

            } else {

                pluginSettings.getParentFile().mkdirs();

                pluginSettings.createNewFile();

            }

            plugin.getConfig().save(pluginSettings);

            isReady = true;

        } catch (Exception e) {

            plugin.log("Couldn't create directories or settings file(s).", Level.SEVERE);

        }

    }

    public void load() {
    }

    public void save() {
    }
}
